/**
 * 订单相关
 * @author [donghui]
 */
const $http = require('../utils/http.js'), api = require('../config/api.js')

/**
 * 查询订单
 */
var _listXcxOrder = function (params) {
  return $http.get(api.GET_ORDER_LIST, params)
}

/**
 * 我的页面查询订单数量
 */
var _getOrderCount = function (params) {
  return $http.get(api.GET_ORDER_COUNT, params)
}

/**
 * 商品直接下单
 */
var _xcxGoodsOrder = function (params) {
  return $http.get(api.SAVE_USER_ORDER_NOW, params)
}

/**
 * 拼团开团确认订单
 */
var _xcxOpenGroup = function (params) {
  return $http.get(api.XCX_OPEN_GROUP, params)
}

/**
 * 查询订单详情
 */
var _getOrderById = function (params) {
  return $http.get(api.GET_ORDER_BY_ID, params)
}

/**
 * 取消订单
 */
var _xcxCancelOrder = function (params) {
  return $http.get(api.XCX_CANCEL_ORDER, params)
}

/**
 * 确认收货
 */
var _xcxOrderConfirm = function (params) {
  return $http.get(api.XCX_ORDER_CONFIRM, params)
}

/**
 * 订单支付
 */
var _xcxPay = function (params) {
  return $http.get(api.XCX_PAY, params)
}

/**
 * 删除订单
 */
var _delXcxOrder = function (params) {
  return $http.get(api.DEL_XCX_ORDER, params)
}

/**
 * 去参团，获取当前团详细
 */
var _xcxOpenGroupList = function (params) {
  return $http.get(api.XCX_OPEN_GROUP_LIST, params)
}

/**
 * 参团确认订单
 */
var _JoinXcxOpenGroup = function (params) {
  return $http.get(api.JOIN_XCX_GROUP, params)
}

module.exports = {
  listXcxOrder: _listXcxOrder,
  getOrderCount: _getOrderCount,
  xcxGoodsOrder: _xcxGoodsOrder,
  xcxOpenGroup: _xcxOpenGroup,
  getOrderById: _getOrderById,
  xcxCancelOrder: _xcxCancelOrder,
  xcxOrderConfirm: _xcxOrderConfirm,
  xcxPay: _xcxPay,
  delXcxOrder: _delXcxOrder,
  xcxOpenGroupList: _xcxOpenGroupList,
  JoinXcxOpenGroup: _JoinXcxOpenGroup
}